package com.choudou5.solr.framework.constants;

/**
 * @name：Solr模块
 * @author：choudou5
 * @date：2018-08-13
 */
public enum SolrModuleEnum {

    QA("qa", "问题库"),
    GOODS("goods", "商品库"),
    ;

    SolrModuleEnum(String key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    private String key;
    private String desc;

    public static String getDefKey(){
       return QA.getKey();
    }

    public static SolrModuleEnum get(String key){
        SolrModuleEnum[] modules = values();
        for (SolrModuleEnum module : modules) {
            if(module.getKey().equals(key)) {
                return module;
            }
        }
        return null;
    }

    public static String getDesc(String key){
        SolrModuleEnum[] modules = values();
        for (SolrModuleEnum module : modules) {
            if(module.getKey().equals(key)) {
                return module.getDesc();
            }
        }
        return key;
    }


    public static SolrModuleEnum[] vals(){
        return values();
    }
    public String getKey() {
        return key;
    }
    public String getDesc() {
        return desc;
    }

}
